# 张量测试
import tensorflow as tf

#注意：X的定义必须是[[]],这样它的秩与Y才相同，才能相乘，好象numpy中没有这个问题
ts_X = tf.Variable([[0.4, 0.2, 0.4]])
ts_Y = tf.Variable([[-0.5, -0.2],
                    [-0.3, 0.4],
                    [-0.5, 0.2]])
W=tf.matmul(ts_X,ts_Y)
with tf.Session() as sess:
    init = tf.global_variables_initializer()
    sess.run(init)
    #X = sess.run(ts_X)
    #Y = sess.run(ts_Y)
    #print(X, Y)
    print(sess.run(W))
tf.summary.merge_all()
#默认写入当前盘的根下，比如：d:/log/area下,可以使用tensorboard --logdir d:/log/area 来查看计算图
tran_writer = tf.summary.FileWriter('/log/area', sess.graph)
